#!/bin/bash


dataMnt=/mnt/server.lan/data
dataStorage=$dataMnt/dataStorage

configfile="${dataStorage}/seafile.server.lan/conf/seafdav.conf"

if [ ! -e "$configfile" ];then
    echo "[E] config file not exist , please re-run after docker container started & inited"
    echo "          : $configfile"
    exit 1
fi

{
cat <<EOF
[WEBDAV]
enabled = true
port = 8080
fastcgi = false
host = 0.0.0.0
share_name = /webdav

EOF
} > "${dataStorage}/seafile.server.lan/conf/seafdav.conf"

chown 1000:1000 "${dataStorage}/seafile.server.lan/conf/seafdav.conf"
docker restart "seafile.server.lan"
